<?php
/**
 * Created by PhpStorm
 * User: Jhinwy
 * Date: 5/20/24
 * Time: 4:24 PM
 */

use Illuminate\Support\Facades\Route;


Route::any('admin/corp/wechat/event/callback', 'Admin\CorpController@eventCallback');
Route::any('admin/corp/wechat/data/callback', 'Admin\KfAccountController@dataCallback');

Route::group(['middleware' => ['cross.http']], function () {
    Route::post('admin/login', 'Admin\AdminController@login');

    Route::group(['namespace' => 'Admin', 'middleware' => ['admin.token', 'throttle:1000,1']], function () {

        // 管理员信息
        Route::group(['prefix' => 'admin'], function () {
            Route::post('list', 'AdminController@getList');
            Route::post('all', 'AdminController@getAll');
            Route::post('detail', 'AdminController@detail');
            Route::post('create', 'AdminController@create');
            Route::post('delete', 'AdminController@delete');
            Route::post('disable', 'AdminController@disable');
            Route::post('logout', 'AdminController@logout');
        });


        // 书籍记录管理
        Route::post('book/record/list', 'BookRecordController@getList');
        Route::post('book/record/save', 'BookRecordController@save');

        // H5落地页管理
        Route::post('lading/page/list', 'LadingPageController@getList');
        Route::post('lading/page/save', 'LadingPageController@save');
        Route::post('lading/page/audit', 'LadingPageController@updateAudit');
        Route::post('lading/page/delete', 'LadingPageController@delete');


        // 企业微信相关
        Route::group(['prefix' => 'corp/wechat'], function () {
            // 企业相关
            Route::post('list', 'CorpController@getCorpList');
            Route::post('all', 'CorpController@getAll');

            // 素材相关
            Route::post('upload/image', 'KfAccountController@uploadImage');
            Route::post('upload/media', 'KfAccountController@uploadMedia');
            Route::post('get/media', 'KfAccountController@getMedia');

            // 客服相关
            Route::post('kf/account/add', 'KfAccountController@addKfAccount');
            Route::post('kf/account/list', 'KfAccountController@getKfAccountList');
            Route::post('kf/account/delete', 'KfAccountController@delKfAccount');
            Route::post('kf/account/link', 'KfAccountController@getKfLink');

            // 客户
            Route::post('kf/account/customer/list', 'KfAccountController@getKfCustomerList');

            // 默认回复
            Route::post('kf/account/set/default', 'KfAccountController@setKfDefault');
            Route::post('kf/account/get/default', 'KfAccountController@getKfDefault');

            // 欢迎语
            Route::post('kf/account/set/welcome', 'KfAccountController@setKfWelcome');
            Route::post('kf/account/get/welcome', 'KfAccountController@getKfWelcome');

            Route::post('kf/account/msg/type', 'KfAccountController@getKfMsgType');

            // 关键字
            Route::post('kf/account/set/keyword', 'KfAccountController@setKfKeyword');
            Route::post('kf/account/get/keyword', 'KfAccountController@getKfKeyword');
            Route::post('kf/account/del/keyword', 'KfAccountController@delKfKeyword');

            // 延时推送
            Route::post('kf/get/push/time', 'KfAccountController@getPushTime');
            Route::post('kf/account/set/push', 'KfAccountController@setKfPush');
            Route::post('kf/account/get/push', 'KfAccountController@getKfPush');
            Route::post('kf/account/del/push', 'KfAccountController@delKfPush');


            // 定时推送
            Route::post('kf/account/set/timing/push', 'KfAccountController@setKfTimingPush');
            Route::post('kf/account/get/timing/push', 'KfAccountController@getKfTimingPush');
            Route::post('kf/account/del/timing/push', 'KfAccountController@delKfTimingPush');

            // 部门相关
            Route::post('department/list', 'DepartmentController@getList');
            Route::post('department/create', 'DepartmentController@createDepartment');
            Route::post('department/delete', 'DepartmentController@delDepartment');
            // 成员相关
            Route::post('department/user/list', 'UserController@getUserList');
            Route::post('department/user/create', 'UserController@createUser');
            Route::post('department/user/delete', 'UserController@delUser');
            Route::post('department/user/assign/category', 'UserController@assignUserCategory');
            Route::post('department/user/assign/admin', 'UserController@assignUserAdmin');
            Route::post('user/pool', 'UserController@getUserPool');
            Route::post('user/all', 'UserController@getAll');

            Route::post('user/remark', 'AccountController@remark');


            // 订单相关
            Route::post('order/list', 'OrderController@getList');
            Route::post('order/code/list', 'OrderController@getCodeList');

            // 激活账号
            Route::post('active/account', 'OrderController@activeAccount');


            // 客户群相关
            Route::post('chat/list', 'ChatController@getList');
            Route::post('chat/msg/list', 'ChatController@getMsgList');
            Route::post('chat/save/msg', 'ChatController@saveChatMsg');
            Route::post('chat/add/msg', 'ChatController@addChatMsg');

            // 外部联系人相关
            Route::post('customer/list', 'CustomerController@getList');

            Route::post('ext/contact/welcome/show', 'ExtContactController@showWelcome');
            Route::post('ext/contact/welcome/save', 'ExtContactController@saveWelcome');


            // 分类相关
            Route::post('category/list', 'CategoryController@getList');
            Route::post('category/all', 'CategoryController@getAll');
            Route::post('category/save', 'CategoryController@save');
            Route::post('category/delete', 'CategoryController@delete');
            Route::post('category/pool', 'CategoryController@getCategoryPool');

            // 数据统计
            Route::post('statistic/user/rankings', 'StatisticsController@getUserRankings');

            // 获客链接管理
            Route::post('link/list', 'CustomerLinkController@getList');
            Route::post('link/create', 'CustomerLinkController@create');
            Route::post('link/delete', 'CustomerLinkController@delete');
            Route::post('link/quota', 'CustomerLinkController@getQuota');


            // 标题图库分类相关
            Route::post('title_gallery/category/list', 'TitleGalleryCategoryController@getList');
            Route::post('title_gallery/category/all', 'TitleGalleryCategoryController@getAll');
            Route::post('title_gallery/category/save', 'TitleGalleryCategoryController@save');
            Route::post('title_gallery/category/delete', 'TitleGalleryCategoryController@delete');

            // 标题库相关
            Route::post('title/list', 'TitleController@getList');
            Route::post('title/save', 'TitleController@save');
            Route::post('title/delete', 'TitleController@delete');

            // 图库相关
            Route::post('gallery/list', 'GalleryController@getList');
            Route::post('gallery/save', 'GalleryController@save');
            Route::post('gallery/delete', 'GalleryController@delete');

            // 文件上传
            Route::post('upload/file', 'UploadController@upload');
        });
    });
});

